<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>

<h3 style="padding-left: 20px;padding-top: 10px">
	<?=$data['name']?>——相关单位<?php if($data['is_activity']==1){$column="activity";}else{$column="contest";}?>
	<a href="./index.php?m=contest&c=manage&a=init&is_activity=<?=$data['is_activity']?>" style="font-size:14px;color: #0000FF"><em>返回上一级</em></a>
</h3>

<div class="subnav">
	<div class="content-menu ib-a blue line-x">
		<a href="./index.php?m=contest&c=manage&a=view&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>" ><em><?php echo L($column)?>详情</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=award&a=init&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"><em><?php echo L($column)?>奖项</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=winner&a=init&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"><em><?php echo L($column)?>获奖</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=process&a=init&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"  ><em><?php echo L($column)?>流程</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=sign&a=init&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"   ><em>报名信息</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=contestant&a=init&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>" ><em>参赛者</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=sponsor&a=init&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"   class="on" ><em>相关单位</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=guest&a=init&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"><em>评委嘉宾</em></a>
	</div>
</div>

<div class="pad-lr-10">

	<form name="searchform" action="" method="get">
		<input type="hidden" value="contest" name="m">
		<input type="hidden" value="sponsor" name="c">
		<input type="hidden" value="init" name="a">
		<input type="hidden" value="<?=$id?>" name="id">
		<?php if(isset($_GET['id'])){?>
			<input type="hidden" value="<?=$_GET['id']?>" name="id">
		<?php }?>
		<table width="100%" cellspacing="0" class="search-form">
			<tbody>
			<tr>
				<td>
					<button type="button" style="float:right;margin-right:20px;margin-top:10px;" onclick="showAdd()" ><em>添加单位</em></button>
					<span style="clear: both"></span>
					<script>
						function showAdd(){
							window.top.art.dialog({
									id: 'add',
									iframe: '?m=contest&c=sponsor&a=add&id=<?=$id?>',
									title: '添加单位',
									width: '900',
									height: '500',
									lock: true
								},
								function() {
									var d = window.top.art.dialog({
										id: 'add'
									}).data.iframe;
									var form = d.document.getElementById('dosubmit');
									form.click();
									return false;
								},
								function() {
									window.top.art.dialog({
										id: 'add'
									}).close()
								});
						}

					</script>

					<div class="explain-col">
						<?php
						$type=isset($_GET['type'])?$_GET['type']:"";
						echo form::select_default($this->sponsor_type,$type,' name="type"','请选择分类');?>
						单位名称：
						<input name="keyword" type="text" value="<?php if(isset($_GET['keyword'])) {echo $_GET['keyword'];}?>"
							   class="input-text" />
						<input type="submit" name="search"  class="button" value="<?php echo L('search')?>" />
					</div>


				</td>
			</tr>
			</tbody>
		</table>
	</form>

	<form name="myform" action="?m=contest&c=sponsor&a=del" method="post"
		onsubmit="return confirm('<?php echo L('confirm')?>')">
		<div class="table-list">
			<table width="100%" cellspacing="0">
				<thead>
					<tr>
						<th align="left" width="20"><input type="checkbox" value=""
							id="check_box" onclick="selectall('id[]');"></th>
						<th align="left">ID</th>
						<th align="left"><?php echo L('contest_sponsor_name')?></th>

						<th align="left"><?php echo L('contest_sponsor_type')?></th>

						<th align="left"><?php echo '单位Logo图';?></th>

						<th align="left"><?php echo '简介';?></th>

						<th align="left"><?php echo '上次编辑者';?></th>

						<th align="left"><?php echo L('contest_operation')?></th>
					</tr>
				</thead>
				<tbody>
<?php
if(!empty($contestinfo)){
foreach ($contestinfo as $k => $v) {
    ?>
    <tr>
		<td align="left"><input type="checkbox"
			value="<?php echo $v['id']?>" name="id[]"></td>
		<td align="left"><?php echo $v['id']?></td>
		<td align="left"><?php echo $v['name']?></td>

		<td align="left"><?php echo $this->sponsor_type[$v['type']];?></td>
		<td align="left"><?php if(!empty($v['logo'])){?><img src="<?php echo $v['logo'];?>" height="60"/><?php }else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
		<td align="left"><?php  if(empty($v['description'])){echo"<span style='color:red;'>（未设置）</span>";}else{echo str_cut($v['description'],20);}?></td>
		<td align="left"><?php  if(empty($v['publisher'])){echo"<span style='color:red;'>（未设置）</span>";}else{echo $v['publisher'];}?></td>

		<td align="left">

			<a  href="javascript:edit('<?php echo $v['id']?>', '<?php echo  new_addslashes(new_html_special_chars($v['name']))?>')">
				[<?php echo L('edit')?>]
			</a>
			<br>
			<a href="?m=contest&c=sponsor&a=del&id=<?php echo $v['id']?>&name=<?php echo $v['name'];?>" onClick="return confirm('<?php echo L('confirm')?>')">
				[<?php echo L('contest_del')?>]
			</a>

		</td>
	</tr>
<?php
}
}else{
    echo "<tr><td colspan='8' style='color:red;font-size:18px;text-align:center;'><span>暂无数据！</span></td></tr>";
}
?>
</tbody>
			</table>

			<div class="btn">
				<label for="check_box">
					<a href="#"
					onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('select_all')?></a>/<a
					href="#"
					onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a></label>
				<input type="submit" class="button"  name="dosubmit"
					value="<?php echo L('delete')?>" />
			</div>

			<div id="pages"><?php echo $pages?></div>
		</div>
	</form>
</div>
<script type="text/javascript">

	function edit(id, name) {
		window.top.art.dialog({id:'edit'}).close();
		window.top.art.dialog({
				title: name,
				id: 'edit',
				iframe: '?m=contest&c=sponsor&a=edit&id=' + id,
				width: '900',
				height: '500'
			},
			function() {
				var d = window.top.art.dialog({
					id: 'edit'
				}).data.iframe;
				d.document.getElementById('dosubmit').click();
				return false;
			},
			function() {
				window.top.art.dialog({
					id: 'edit'
				}).close()
			});
	}

</script>
</body>
</html>